import Taro, { Component } from '@tarojs/taro'
import { View, Text, Image } from "@tarojs/components"
import Addcut from './addcut.js'
import './foodlist.scss'
import { list } from 'postcss';
class FoodList extends Component {
  constructor() {
    super(...arguments);
    this.state = {
      List: []
    }
  }

  render() {
    let { currentList, selectCata } = this.props


    return (
      <View className="foodlist">
        <Text className="food-title">{selectCata ? selectCata.name : ""}</Text>
        <View className="list-box">
          {
            currentList.map((item, index) => {
              return (
                <View className="food-item" key={item.id}>
                  <Image className="food-item-img" src={item.img == 2 ? require('../../../../assets/img/2.jpg') : require('../../../../assets/img/1.jpg')} />
                  <View className="food-item-info">
                    <Text>{item.title}</Text>
                    <Text>月售：{item.sole}</Text>
                    <Text className="price">￥{item.price}</Text>
                    <Addcut foodList={currentList} style="position: absolute;bottom:10PX;right:10PX" />
                  </View>
                </View>)
            })
          }
        </View>
      </View>
    )
  }
}
export default FoodList